Skip to content

Conversation

@ashishrp-aws
Copy link
Contributor

Problem

Responses need to stop for new user prompt and fix user history

Solution

  • featureflag to check the response state to stop the responses.
  • Fixing history incase of exception or stopped responses.

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ashishrp-aws ashishrp-aws requested a review from a team as a code owner April 3, 2025 22:39
@github-actions
Copy link

github-actions bot commented Apr 3, 2025

  • This pull request modifies code in src/* but no tests were added/updated.
    • Confirm whether tests should be added or ensure the PR description explains why tests are not required.
  • This pull request implements a feat or fix, so it must include a changelog entry (unless the fix is for an unreleased feature). Review the changelog guidelines.
    • Note: beta or "experiment" features that have active users should announce fixes in the changelog.
    • If this is not a feature or fix, use an appropriate type from the title guidelines. For example, telemetry-only changes should use the telemetry type.

await this.messenger.sendAIResponse(response, session, tabID, triggerID, triggerPayload, chatHistory)

// Turn off AgentLoop flag after sending the AI response
this.sessionStorage.setAgentLoopInProgress(tabID, false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this going to keep setting/resetting the flag within a single agentic loop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currently yes...i'll expand it to tool use next to stop tool execution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit limited right now

Comment on lines +171 to +172
} else {
newUserMessage.userInputMessage.userInputMessageContext = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would this happen? (UserInputMessageContext is undefined)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As of now..haven't seen any case of UserInputMessageContext being undefined but covered the case for any potential errors to maintain history thread.

return true
},
{ timeout: 60000, truthy: true }
{ timeout: 600000, truthy: true }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an intentional increase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes....because fsWrite for long files is exceeding and failing the conversation from service chat history validations.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to add bit more context: the 60 second timeout is for the mynah chat, for agentic chat, we noticed the request could easily exceed 60 seconds if it's trying to create some new large files, hence making this change. (This is also causing the history to be invalid when we hit the 60s timeout)

return newUserMessage
}
}
private findIndexToTrim(): number | undefined {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we would probably change this to follow more of what the CLI will do using history compacting. This is ok for now.

Copy link
Contributor Author

@ashishrp-aws ashishrp-aws Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will look into the CLI's history compacting. I think they followed this sliding window trimming until a 10 days ago when i ported their history utilities.

@ashishrp-aws
Copy link
Contributor Author

/retryBuilds

@zixlin7 zixlin7 merged commit 4446831 into aws:feature/agentic-chat Apr 4, 2025
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants